
<template>
<!-- 美团对账正常单    美团对账异常单 -->
    <div class="storeInfo">
        <div class="head">
            <el-form class="headForm">
                <el-form-item style="width:230px">
                    <el-date-picker
                        v-model="timerange"
                        type="daterange"
                        value-format="yyyy-MM-dd"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期">
                    </el-date-picker>
                </el-form-item>

                <el-form-item label="">
                    <el-select clearable v-model="form.type" placeholder="功能">
                        <el-option v-for="item in FN" :key="item.status" :label="item.status_cn" :value="item.status"></el-option>
                    </el-select>
                </el-form-item>
                <el-button type="danger" @click="search" >搜索</el-button> 
                <el-button type="danger" @click="exportInfo" >导出明细</el-button> 
                <!-- <el-button class="btnTxt">结算金额合计:121231545元</el-button>  -->
                
            </el-form>
        </div> 
        
        <!-- table -->
        <div class="tabContainer">
            <el-table :data="tableData" stripe style="width: 100%;text-align:center">
                <el-table-column prop="create_time" label="操作时间" fixed></el-table-column>
                <el-table-column prop="nickname" label="操作人" width="200"> </el-table-column>
                <el-table-column prop="type_cn" label="功能" width="240"></el-table-column>
                <el-table-column prop="content" label="内容"></el-table-column>
                <el-table-column prop="remark" label="操作备注"></el-table-column>  
            </el-table>                       
        </div>
        <!-- 分页部分 没有分页-->
        <!-- <el-pagination
            background
            layout="total, prev, pager, next, jumper"
            @current-change="changePage"
            :page-size="size"
            :current-page.sync="pageNum"
            :hide-on-single-page=true
            :total="total">{{total}}
        </el-pagination> -->
    


    </div>
  
</template>

<style>
.setWidth{width:140px !important}
</style>
<script>
import Vue from 'vue';
import { abc } from "../../../../js/abc.js";
import {potUrl} from '../../../../js/config_url.js'; 

export default {
   name: 'HelloWorld',
    data () {
    return {
        FN:[
            {status:'1',status_cn:"异常订单处理"},
            {status:'2',status_cn:"异常对账单处理"}
        ],//美团类型
        
        form:{
            page:1,
            size:20,
        },

        tableData:[],
        total:50,
        size:20,
        pageNum:1,
        timerange:''
    }
  },
   mounted(){
        let that = this;
        abc.get(that,potUrl.meituanlog,that.form,(res)=>{
            that.tableData=res.data.list;
            that.total = res.data.total;
        })//列表
  },
  methods:{
    search(){
        //搜索有问题，不能精确返回时间区间的的内容，反而返回了全部的条数
        let that = this;
        that.form.start_time = that.timerange[0]
        that.form.end_time = that.timerange[1]
        that.getList()
    },
    // changePage(val){
    //     var that = this;
    //     that.pageNum = val;
    //     that.form.page = val;
    //     that.getList()
    // },

    exportInfo(){
        //导出的内容没有根据时间区间给出相应数据-error
        let that = this;
        let str = '';
        if(that.timerange.length != 0){
            str += '&start_time='+that.timerange[0]+'&end_time='+that.timerange[1]
        }
        str += '&type='+that.form.type;
        let iData = '?token=' + abc.getSession('token') + '&user_id=' + abc.getSession('user_id') + '&store_id=' + abc.getSession("store_id") + '&platform=operate'+str
        window.location.href = abc.hostUrl + '/operate/meituan/exportlog' + iData
    },
    getList(){
        let that = this;
        abc.get(that,potUrl.meituanlog,that.form,(res)=>{
            that.tableData=res.data.list;
            that.total = res.data.total;
        })//列表
    }
  }
}
</script>
